#include "cpuclock.h"

#ifdef __cplusplus
extern "C" {
#endif

void reset(TimeStemp * pasm) {
	pasm->end = 0;
	pasm->start = 0;
}

void start(TimeStemp * pasm) {
	__asm__ __volatile__ (
		".byte 0x0f; .byte 0x31"
		: "=A" (pasm->start)
	);
}

void end(TimeStemp * pasm) {
	__asm__ __volatile__ (
		".byte 0x0f; .byte 0x31"
		: "=A" (pasm->end)
	);
}

long long get_qt_result(TimeStemp * pasm) 
{
	return pasm->end - pasm->start; 
}

#ifdef __cplusplus
}
#endif